﻿using Ebt.Mvvm;
using Windows.UI.Xaml.Controls;
using Windows_8_MVVM.Pages;

namespace Windows_8_MVVM.ViewModels
{
    public class Navigation
    {
        public Navigation()
        {
            NavigationState = new NavigationState();
        }

        /// <summary>
        /// This property must be bind to the <see cref="Frame"/> using <see cref="ElementBinder.WrapperProperty"/> attached property.
        /// Do not use it directly.
        /// </summary>
        public NavigationState NavigationState { get; set; }

        /// <summary>
        /// Clears the navigation history
        /// </summary>
        public void Reset()
        {
            NavigationState.Reset();
        }

        public bool CanGoBack
        {
            get { return NavigationState.CanGoBack; }
        }

        public void GoBack()
        {
            NavigationState.GoBack();
        }

        public void GoToHomePage()
        {
            NavigationState.Navigate(typeof(HomePage));
        }

        public void GoToSearchPage()
        {
            NavigationState.Navigate(typeof(SearchPage));
        }
    }
}